Skip to content

Allow FileStoreCommit for PK tables with postpone bucket mode#337

Open
liujiayi771 wants to merge 3 commits into
alibaba:mainfrom
liujiayi771:fix/allow-postpone-bucket-commit
Open

Allow FileStoreCommit for PK tables with postpone bucket mode#337
liujiayi771 wants to merge 3 commits into
alibaba:mainfrom
liujiayi771:fix/allow-postpone-bucket-commit

Conversation

@liujiayi771
Copy link
Copy Markdown
Contributor

@liujiayi771 liujiayi771 commented Jun 3, 2026

Summary

  • Allow FileStoreCommit::Create to proceed for PK tables when using postpone bucket mode (bucket=-2)
  • In postpone bucket mode, all records are first stored in the bucket-postpone directory of each partition and are not available to readers. To move the records into the correct bucket and make them readable, a compaction job needs to be run (via compact procedure or triggered by the catalog server)
  • The commit logic (manifest and snapshot generation) is identical to append tables, so there is no reason to block it
  • PK tables with fixed bucket (bucket > 0) remain blocked as before

Test plan

  • TestPostponeBucketPKTableCommitAllowed: PK table with bucket=-2FileStoreCommit::Create succeeds without workaround flag
  • TestFixedBucketPKTableCommitRejected: PK table with bucket=4FileStoreCommit::Create returns NotImplemented

Reference

@liujiayi771 liujiayi771 force-pushed the fix/allow-postpone-bucket-commit branch 2 times, most recently from eb47b05 to b44744d Compare June 4, 2026 09:19
@zjw1111 zjw1111 requested a review from Copilot June 6, 2026 09:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates FileStoreCommit::Create to allow committing primary-key (PK) tables when they use postpone bucket mode (bucket = -2), while still rejecting PK tables configured with fixed buckets (bucket > 0). This aligns commit eligibility with the fact that postpone bucket mode writes into bucket-postpone/ and relies on later compaction to redistribute into real buckets.

Changes:

  • Permit FileStoreCommit::Create for PK tables when bucket = -2 (postpone bucket mode).
  • Keep existing behavior (reject) for PK tables with fixed buckets (bucket > 0).
  • Add unit tests covering allowed/rejected cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/paimon/core/operation/file_store_commit.cpp Adjusts PK-table gating logic to allow postpone bucket mode commits.
src/paimon/core/operation/file_store_commit_impl_test.cpp Adds tests validating postpone-bucket PK commit allowed and fixed-bucket PK commit rejected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/paimon/core/operation/file_store_commit.cpp Outdated
Comment thread src/paimon/core/operation/file_store_commit_impl_test.cpp Outdated
Comment thread src/paimon/core/operation/file_store_commit_impl_test.cpp Outdated
Comment thread src/paimon/core/operation/file_store_commit_impl_test.cpp
liujiayi771 and others added 3 commits June 6, 2026 23:47
Postpone bucket mode (bucket=-2) writes data like an append table:
all files go to bucket--2/ directory and the REST catalog server
handles bucket redistribution during background compaction. The
commit logic (manifest and snapshot generation) is identical to
append tables, so there is no reason to block it.

See: https://paimon.apache.org/docs/master/primary-key-table/data-distribution/#postpone-bucket

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Replace raw schema options map lookup with TableSchema::NumBuckets()
  for postpone bucket check
- Use Options::BUCKET constant instead of hardcoded "bucket" in tests
- Add IsNotImplemented() status kind assertion in rejection test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@liujiayi771 liujiayi771 force-pushed the fix/allow-postpone-bucket-commit branch from 2eccc61 to f9c9267 Compare June 6, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants